#define _CRT_SECURE_NO_WARNINGS  1
#include<stdio.h>
void adju(int* arr, int sz)
{
	int i = 0;
	int j = sz - 1;
	while (i < j)
	{

		while (i < sz && arr[i] % 2 == 1)
		{
			i++;
		}
		while (j >= 0 && arr[j] % 2 == 0)
		{
			j--;
		}
		if (i < j)
		{
			arr[i] = arr[i] ^ arr[j];
			arr[j] = arr[i] ^ arr[j];
			arr[i] = arr[i] ^ arr[j];
		}
	}
}
int main()
{
	int arr[] = { 1, 5, 6, 7, 8, 2, 4, 3, 9 };
	int sz = sizeof(arr) / sizeof(arr[0]);

	adju(arr, sz);
	int i = 0;
	for (i = 0; i < sz; i++)
	{
		printf("%d ", arr[i]);
	}


	return 0;
}
